package com.hainatong.shiphelper.mainhome.adapter;

import org.jetbrains.annotations.NotNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hainatong.shiphelper.R;
import com.hainatong.shiphelper.databinding.ItemSysMsgViewBinding;
import com.hainatong.shiphelper.mainhome.entity.MsgBean;
import com.hainatong.mvvmbase.base.BaseBean;

public class SysMsgProvider extends BaseItemProvider<BaseBean>
{


    @Override
    public int getItemViewType()
    {
        return SysMsgItemType.MSG_VIEW;
    }

    @Override
    public int getLayoutId()
    {
        return R.layout.item_sys_msg_view;
    }

    @Override
    public void convert(@NotNull BaseViewHolder baseViewHolder, BaseBean baseBean)
    {
        if( baseBean == null )
        {
            return;
        }
        if( baseBean instanceof MsgBean)
        {
            baseViewHolder.setText(R.id.tv_msg_title, ((MsgBean) baseBean).getTitle() );
            baseViewHolder.setText(R.id.tv_notify_obj, ((MsgBean) baseBean).getDeptname() );
            baseViewHolder.setText(R.id.tv_notify_time, ((MsgBean) baseBean).getUrge_time() );
            baseViewHolder.setText(R.id.tv_content, ((MsgBean) baseBean).getMessage() );
        }

        //binding.tvMsgTitle.setText( ((SysMsgBean) baseBean).getName() );
        //binding.tvContent.setText( ((SysMsgBean) baseBean).getName() );
        //binding.tvNotifyTime.setText( ((SysMsgBean) baseBean).getTime() );
        //binding.tvLocation.setText( ((SysMsgBean) baseBean).getLocation() );


        ItemSysMsgViewBinding binding = baseViewHolder.getBinding();

        if( binding != null )
        {
            /*
            binding.setSysMsg((SysMsgBean) baseBean);
            binding.executePendingBindings();
            */
        }
    }
}
